﻿using System;
using System.Collections.Generic;
using DyUi.Base.Interfaces;

namespace DyUi.Core
{
    public class DyUiServiceLocator : IDyUiServiceLocator
    {
        readonly Dictionary<String, IDyUiService> _services = new Dictionary<String, IDyUiService>();

        public IDyUiService GetService(string name)
        {
            if (_services.ContainsKey(name))
            {
                return _services[name];    
            }

            return null as IDyUiService;
        }

        public void SetService(string name, IDyUiService service)
        {
            _services[name] = service;
        }

        public IEnumerable<IDyUiService> Services { get { return _services.Values; } }
    }
}
